package DataGo;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Date09 {
    public static void main(String[] args) {
       LocalDateTime localDateTime =LocalDateTime.of(2222,6,4,12,3,4);
      //  System.out.println(localDateTime);不精确，通过datetimeFormatter.ofpattern格式化，指定格式转字符
       DateTimeFormatter dateTimeFormatter= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
      String  l=  localDateTime.format(dateTimeFormatter);
        System.out.println(l);
        String S="2011-12-12 12:12:12";
        DateTimeFormatter dateTimeFormatter1= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime I= LocalDateTime.parse(S,dateTimeFormatter1);
        System.out.println(I);
    }
}
